package com.bill.springcloud.ribbon;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Ribbon测试
 * @fileName: ServiceRibbonApplication.java
 * @author: bin.li01
 * @date: 2018/2/1 15:34 
 * @version: v1.0.0
 */
@SpringBootApplication
@EnableDiscoveryClient
public class ServiceRibbonApplication {

	public static void main(String[] args) {
		SpringApplication.run(ServiceRibbonApplication.class, args);
	}

	@Bean
	//@LoadBalanced注解表明这个restRemplate开启负载均衡的功能。
	@LoadBalanced
	public RestTemplate restTemplate(){
		return new RestTemplate();
	}
}
